<div class="margin10px">
    <table class="table table-bordered table-hover">
        <tr>
            <td class="text-right tdf" width="116">原密码：</td>
            <td><input class="form-control form-focus input_text" type="password" name="formPassword" id="formPassword" /></td>
        </tr>
        <tr>
            <td class="text-right tdf">新密码：</td>
            <td><input class="form-control form-focus input_text" type="password" name="admin_password" id="admin_password" /></td>
        </tr>
        <tr>
            <td class="text-right tdf">重复新密码：</td>
            <td><input class="form-control form-focus input_text" type="password" name="rpPassword" id="rpPassword" /></td>
        </tr>
        <tr>
            <td class="text-right tdf">&nbsp;</td>
            <td><input type="submit" name="submit_account_edit" value="修改" class="btn btn-primary" onclick="checkUserPassword()" /></td>
        </tr>
    </table>
</div>
<script type="text/javascript">
	//验证
	function checkUserPassword()
    {
		var formPassword = $.trim($('#formPassword').val());
		var admin_password = $.trim($('#admin_password').val());
		var rpPassword = $.trim($('#rpPassword').val());
		if(formPassword == ''){
			alert('请输入原密码');
			$('#formPassword').focus();
			return false;
		}
		if(admin_password == ''){
			alert('请输入新密码');
			$('#admin_password').focus();
			return false;
		}
		if(rpPassword == ''){
			alert('请重复输入新密码');
			$('#rpPassword').focus();
			return false;
		}
		if(admin_password != rpPassword){
			alert('两次输入密码不一致，请重新输入');
			$('#admin_password').val('');
			$('#rpPassword').val('');
			return false;
		}
		$.ajax({
			url:"<?php echo U('index/pub_change_password');?>",
			data:{'formPassword':formPassword, 'admin_password':admin_password, 'rpPassword':rpPassword, 'do':1},
            type:'POST',
            dataType:'json',
			success:function(msg){
				if(msg.st == 'y'){
					alert('操作成功');
                    closeZuiModal();
				}else{
					alert(msg.note);
					window.location = "<?php echo U('auth/logout');?>";
				}
                closeZuiModal();
			},
			error:function(){
				alert('网络繁忙，请稍后重试');
			}
		});
		return false;
	}
</script>